/**
 * 弱引用遭到gc就会回收
 *
 */
package org.example.juc.threadlocal;



/**
 * @author songyafei
 */
public class WeakReferenceTest {
    public static void main(String[] args) {
        java.lang.ref.WeakReference<M> m = new java.lang.ref.WeakReference<>(new M());

        System.out.println(m.get());
        System.gc();
        System.out.println(m.get());


        ThreadLocal<M> tl = new ThreadLocal<>();
        tl.set(new M());
        tl.remove();

    }
}

